//
//  UIViewController+Mango.h
//  Mango
//
//  Created by 胡超 on 2018/11/30.
//  Copyright © 2018 胡超. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef void(^MGAlertHandler)(NSInteger idx);
typedef void(^MGAlertInputHandler)(NSInteger idx, NSArray <UITextField *> *textfields);
typedef void(^MGAlertInputConfiguration)(UITextField *textfield);

@interface UIViewController(Mango)

/**
 [self alert:@"title" message:@"message" cancelButton:@"Cancel" otherButtons:@[@"OK"] handler:^(NSInteger idx) {
     // do something...
 }];
 */
- (void)alert:(nullable NSString *)title message:(nullable NSString *)message cancelButton:(nullable NSString *)cancelButton otherButtons:(nullable NSArray *)otherButtons handler:(nullable MGAlertHandler)handler;

/**
 [self alertInput:@"title" message:@"message" cancelButton:@"Cancel" otherButtons:@[@"OK"] handler:^(NSInteger idx, NSArray<UITextField *> * textfields) {
     // do something...
 } configuration:^(UITextField * _Nonnull textfield) {
     // 配置UITextField
 }, ^(UITextField * _Nonnull textfield) {
     // 配置UITextField
 }, nil];
 */
- (void)alertInput:(nullable NSString *)title message:(nullable NSString *)message cancelButton:(nullable NSString *)cancelButton otherButtons:(nullable NSArray *)otherButtons handler:(nullable MGAlertInputHandler)hander configuration:(MGAlertInputConfiguration)configuration, ...;

/**
 [self actionSheet:@"title" message:@"message" cancelButton:@"Cancel" otherButtons:@[@"OK"] handler:^(NSInteger idx) {
     // do something...
 }];
 */
- (void)actionSheet:(nullable NSString *)title message:(nullable NSString *)message cancelButton:(nullable NSString *)cancelButton otherButtons:(nullable NSArray *)otherButtons handler:(nullable MGAlertHandler)handler;

@end

NS_ASSUME_NONNULL_END
